from selenium.webdriver.common.by import By
from pages.base_page import Page


class LanguagePage(Page):
    ele_page_title = (By.XPATH, u"//h3[text()='Language']")
    ele_language_field = (By.XPATH, u"//div[@data-formfield='language']")
    ele_customization = (By.XPATH, u"//p[@data-tag='cardTitle']")
    ele_button_save = (By.XPATH, u"//span[@class='MuiButton-label' and text()='Save']")

    def __init__(self, driver, url, site_id):
        Page.__init__(self, driver, url)
        self.site_id = site_id
        self.url = url

    def list_page_eles_check(self):
        self.find_element(*self.ele_page_title).is_enabled()
        self.find_element(*self.ele_language_field).is_enabled()
        self.find_element(*self.ele_customization).is_enabled()
        self.find_element(*self.ele_button_save).is_enabled()

    def save_config(self):
        self.click(self.ele_button_save)
